<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <div id="search">
        </div>
        <table id="grid" class="scroll" cellpadding="0" cellspacing="0">
        </table>
        <div id="pager" class="scroll" style="text-align: center;">
        </div>
    </div>
    <br />
    <%= Html.ActionLink("Create New", "Create") %>
    <br />
    <br />
    <input type="button" value="Insert" id="btnInsert" name="btnInsert" />
    <% using (Html.BeginForm(new { Action = "ExportToExcel" }))
       {%>
    <input type="submit" value="Export to Excel" />
    <% } %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">

    <script src="../../Scripts/jqGridJs/grid.inlinedit.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript" src="<%= Url.Content("~/Scripts/Products.js") %>"></script>

    <script src="../../Scripts/jqGridJs/grid.base.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#btnInsert').click(function() {
                
                var datarow = { Edit: "Edit", Details: "Details", ProductID: "99", ProductName: "test3", UnitPrice: "400.00", Discontinued: "false" };
                var su = $('grid').addRowData(99, datarow);
                if (su)
                    alert("Succes. Write custom code to add data in server");
                else alert("Can not update");
            });
        });
    </script>

</asp:Content>
